# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-htmlparser
pkgname=('python2-htmlparser' 'python-htmlparser')
_pkgname=HTMLParser
pkgver=0.0.2
pkgrel=9
pkgdesc='Backport of HTMLParser from python 2.7.'
arch=('any')
url='https://pypi.python.org/pypi/HTMLParser/'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://pypi.python.org/packages/85/d1/46b0a439e88974c99785361069134522dd46012eef9578e1623821368e24/$_pkgname-$pkgver.tar.gz")
sha512sums=('1bf869ae57785b79f09115d6d7b5b6efdb6c28bfd5411068415c1b787ba2689da05ca9f9895c865e680e1e410f9c220bcfa36cf62e66e587a268423a614fcb3a')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-htmlparser() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-htmlparser() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

